package com.gaofeng.day13;

public class PhoneTest {
    public static void main(String[] args) {
        Phone[] arr = new Phone[3];
        // 创建手机对象
        Phone p1 = new Phone("xiaomi",2999,"red");
        Phone p2 = new Phone("huawei",6999,"white");
        Phone p3 = new Phone("iphone",4999,"green");


        arr[0] = p1;
        arr[1] = p2;
        arr[2] = p3;
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i].getBrand() +"--"+arr[i].getPrice() +"--" + arr[i].getColor());
            sum += arr[i].getPrice();
        }

        double avg = sum / arr.length;
        System.out.println(avg);
    }
}
